Path: blob/master/2. NumPy.ipynb
107 views


Numpy: Numeric computing library
NumPy (Numerical Python) is one of the core packages for numerical computing in Python. Pandas, Matplotlib, Statmodels and many other Scientific libraries rely on NumPy.
NumPy major contributions are:
Efficient numeric computation with C primitives
Efficient collections with vectorized operations
An integrated and natural Linear Algebra API
A C API for connecting NumPy with libraries written in C, C++, or FORTRAN.
Let's develop on efficiency. In Python, everything is an object, which means that even simple ints are also objects, with all the required machinery to make object work. We call them "Boxed Ints". In contrast, NumPy uses primitive numeric types (floats, ints) which makes storing and computation efficient.

Hands on!
Basic Numpy Arrays

Array Types

Dimensions and shapes
If the shape isn't consistent, it'll just fall back to regular Python objects:

Indexing and Slicing of Matrices

Summary statistics
And many more...

Broadcasting and Vectorized operations

Boolean arrays
(Also called masks)

Linear Algebra

Size of objects in Memory
### Int, floats
### Lists are even larger
### And performance is also important

Useful Numpy functions
random
### arange
### reshape
### linspace
### zeros, ones, empty
identity and eye
